import { defineConfig } from 'umi';
import pageRoutes from './routes';
import * as process from "node:process";


const { REACT_APP_ENV } = process.env;
console.log(REACT_APP_ENV,"环境变量")
const appName = 'IntellectAssistant';
const appTitle = 'IntellectAssistant AI';

export default defineConfig({
  // base: '/digitalizeStore/knowledge/p2/',
  // publicPath: '/digitalizeStore/knowledge/p2/',
  hash: true,
  antd: {},
  dva: {
    hmr: true,
  },
  dynamicImportSyntax: {},
  locale: {
    default: 'zh-CN',
    antd: true,
    baseNavigator: true,
  },
  targets: {
    ie: 11,
  },
  routes: pageRoutes,
  access: {},
  theme: {
    'root-entry-name': 'variable',
  },
  esbuild: {},
  title: false,
  ignoreMomentLocale: true,
  // proxy: proxy[REACT_APP_ENV || 'dev'],
  proxy: {
    '/chatUrl': {
      // 要代理的地址
      // target: 'http://10.242.31.70:9599/',  //代理生产
      target: 'http://10.162.145.27:8985/',  //代理生产
      changeOrigin: true,
      secure: false, //设置证书免校验
      ws: false, // 代理的WebSockets
      pathRewrite: { '^/chatUrl': '' },
    },
    '/lianTongUrl': {
      // 要代理的地址
      // target: 'http://10.242.31.70:8082/', //代理地址生产
      target: 'http://10.162.145.28:8082/', //代理地址
      changeOrigin: true,
      secure: false, //设置证书免校验
      ws: false, // 代理的WebSockets
      pathRewrite: { '^/lianTongUrl': '' },
    },
    '/userUrl': {
      // 要代理的地址
      // target: 'http://10.242.31.70:8092/', //代理地址生产
      target: 'http://10.162.145.27:8131/', //代理地址
      changeOrigin: true,
      secure: false, //设置证书免校验
      ws: false, // 代理的WebSockets
      pathRewrite: { '^/userUrl': '' },
    },
    '/lianTongUpLoadUrl': {
      // 要代理的地址
      // target: 'http://10.242.31.70:8861/', //代理地址生产
      target: 'http://10.162.145.28:8861/', //代理地址
      changeOrigin: true,
      secure: false, //设置证书免校验
      ws: false, // 代理的WebSockets
      pathRewrite: { '^/lianTongUpLoadUrl': '' },
    },
    '/lianTongUpLoadUrlFile': {
      // 要代理的地址
      // target: 'http://127.0.0.1:8861/', //代理地址生产
      target: 'http://10.162.145.28:8861/', //代理地址
      changeOrigin: true,
      secure: false, //设置证书免校验
      ws: false, // 代理的WebSockets
      pathRewrite: { '^/lianTongUpLoadUrlFile': '' },
    },
    '/manager': {
      // 要代理的地址
      // target: 'https://10.242.31.70:8889/', //代理地址生产
      target: 'https://10.162.145.27:8910/', //代理地址
      changeOrigin: true,
      secure: false, //设置证书免校验
      ws: false, // 代理的WebSockets
    },
  },
  manifest: {
    basePath: '/',
  },
  define: {
    APP_NAME: appName,
    TITLE: appTitle,
    "process.env.REACT_APP_ENV": REACT_APP_ENV || '',
  },
  // Fast Refresh 热更新
  fastRefresh: {},
  nodeModulesTransform: { type: 'none' },
  mfsu: {},
  webpack5: {},
  //exportStatic: {},
});
